/**
 * 
 */
package com.google.code.netz.wfe.model;

import com.google.code.netz.wfe.api.IManaged;

/**
 * A {@link WorkItem} instance when executed by a specific {@link Resource}
 * becomes an {@link Activity}.
 * 
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id: Activity.java 271 2009-01-27 14:10:12Z rahul.thakur.xdev $
 */
public class Activity implements IManaged {

	private WorkItem<?> workItem;

	private Resource resource;

	private boolean isActive;

	private State currentState = State.STATE_DEFAULT;

	/**
	 * @param workItem
	 * @param resource
	 */
	public Activity(WorkItem<?> workItem, Resource resource) {
		super();
		this.workItem = workItem;
		this.resource = resource;
	}

	/**
	 * @return the workItem
	 */
	public WorkItem<?> getWorkItem() {
		return workItem;
	}

	/**
	 * @return the resource
	 */
	public Resource getResource() {
		return resource;
	}

	/**
	 * @return the isActive
	 */
	public boolean isActive() {
		return isActive;
	}

	/**
	 * @param isActive
	 *            the isActive to set
	 */
	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.api.IManaged#getCurrentState()
	 */
	@Override
	public State getCurrentState() {
		return this.currentState;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.api.IManaged#setCurrentState(com.google.code
	 *      .netz.wfe.model.State)
	 */
	@Override
	public void setCurrentState(State state) {
		this.currentState = state;
	}

}
